---
/**
* ============================================================
* SVGarden โ https://www.svgarden.dev
* Author : Simon-Pierre Boucher
* Contact: contact@spboucher.ai
* File : src/pages/category/[cat].astro
* Desc : Per-category gallery page
* ============================================================
*/
import Base from '../../layouts/Base.astro';
import SnippetCard from '../../components/SnippetCard.astro';
import { loadSnippets, loadCategories } from '../../lib/snippets.mjs';
export async function getStaticPaths() {
const categories = await loadCategories();
return categories.map((c) => ({ params: { cat: c.name } }));
}
const { cat } = Astro.params;
const snippets = (await loadSnippets()).filter((s) => s.category === cat);
const categories = await loadCategories();
---
{snippets.length} snippet{snippets.length === 1 ? '' : 's'} in this category.{cat}